﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace ATEGo
{
    /// <summary>
    /// TestTree.json
    /// </summary>
    public class TestTree : BJsonFile
    {
        /// <summary>
        /// 编码
        /// </summary>
        public List<string> branch { get; set; }

        /// <summary>
        /// cmd命令集文件地址
        /// </summary>
        public Dictionary<string,string> cmdSuitsFile { get; set; }

        /// <summary>
        /// 测试流程
        /// </summary>
        public Dictionary<string, TestOrderItem> testOrder { get; set; }

    }

    /// <summary>
    /// TestTree.json→testOrder的每个项
    /// </summary>
    public class TestOrderItem
    {
        /// <summary>
        /// cmdSuits文件在哪里
        /// </summary>
        public string cmdSuitsFile { get; set; }
        /// <summary>
        /// 是串行执行还是并行执行
        /// </summary>
        public string sequence { get; set; } = "true";
        /// <summary>
        /// 具体的cmdTag
        /// </summary>
        public List<string> items { get; set; }
        /// <summary>
        /// 结束cmdTag
        /// </summary>
        public List<string> end_items { get; set; }

        /// <summary>
        /// 返回执行流程的cmdTag的名字
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        [JsonIgnore]
        public string this[int index]
        {
            get
            {
                return items[index];
            }
        }

        [JsonIgnore]
        public int Count
        { get { return items.Count; } }
    }
}
